home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 24 / CU Amiga Magazine's Super CD-ROM 24 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-07].iso / CUCD / Programming / MCC_NList / Developer / C / Examples / NList-Demo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-04  |  35.0 KB  |  982 lines

  1.  
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include <dos/dos.h>
  6. #include <exec/types.h>
  7. #include <exec/memory.h>
  8. #include <exec/ports.h>
  9. #include <exec/io.h>
  10. #include <libraries/dos.h>
  11. #include <libraries/dosextens.h>
  12. #include <libraries/gadtools.h>
  13. #include <libraries/asl.h>
  14. #include <libraries/mui.h>
  15. #include <devices/clipboard.h>
  16. #include <workbench/workbench.h>
  17. #include <intuition/intuition.h>
  18. #include <intuition/classusr.h>
  19. #include <graphics/gfxmacros.h>
  20.  
  21. #ifdef __GNUC__
  22. #include <proto/alib.h>
  23. #include <proto/exec.h>
  24. #include <proto/dos.h>
  25. #include <proto/gadtools.h>
  26. #include <proto/asl.h>
  27. #include <clib/muimaster_protos.h>
  28. #endif
  29.  
  30. #ifdef __SASC
  31. #include <clib/alib_protos.h>
  32. #include <clib/exec_protos.h>
  33. #include <clib/dos_protos.h>
  34. #include <clib/icon_protos.h>
  35. #include <clib/graphics_protos.h>
  36. #include <clib/intuition_protos.h>
  37. #include <clib/gadtools_protos.h>
  38. #include <clib/utility_protos.h>
  39. #include <clib/asl_protos.h>
  40. #define REG(x) register __ ## x
  41. #define ASM    __asm
  42. #define SAVEDS __saveds
  43. #include <pragmas/exec_sysbase_pragmas.h>
  44. #include <pragmas/dos_pragmas.h>
  45. #include <pragmas/icon_pragmas.h>
  46. #include <pragmas/graphics_pragmas.h>
  47. #include <pragmas/intuition_pragmas.h>
  48. #include <pragmas/gadtools_pragmas.h>
  49. #include <pragmas/utility_pragmas.h>
  50. #include <pragmas/asl_pragmas.h>
  51. #include <pragmas/muimaster_pragmas.h>
  52. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase;
  53. ULONG __stack = 16384;
  54. int CXBRK(void) { return(0); }
  55. int _CXBRK(void) { return(0); }
  56. void chkabort(void) {}
  57. #endif
  58.  
  59. struct Library *MUIMasterBase;
  60.  
  61. #include <MUI/NListview_mcc.h>
  62. #include <MUI/NFloattext_mcc.h>
  63.  
  64. #include <proto/muimaster.h>
  65.  
  66.  
  67. /* ************ IMG definitions ************** */
  68.  
  69. const ULONG list_colors[24] =
  70. {
  71.     0xadadadad,0xadadadad,0xadadadad,
  72.     0x7b7b7b7b,0x7b7b7b7b,0x7b7b7b7b,
  73.     0x3b3b3b3b,0x67676767,0xa2a2a2a2,
  74.     0xadadadad,0xadadadad,0xadadadad,
  75.     0xadadadad,0xadadadad,0xadadadad,
  76.     0xadadadad,0xadadadad,0xadadadad,
  77.     0xffffffff,0xffffffff,0xffffffff,
  78.     0x00000000,0x00000000,0x00000000,
  79. };
  80.  
  81. #define LIST_WIDTH        23
  82. #define LIST_HEIGHT       14
  83. #define LIST_DEPTH         3
  84. #define LIST_COMPRESSION   0
  85. #define LIST_MASKING       2
  86.  
  87. const UBYTE list_body[168] = {
  88. 0x00,0x00,0x44,0x00,0xff,0xff,0xb8,0x00,0xff,0xff,0xb8,0x00,0x00,0x00,0x00,
  89. 0x00,0x80,0x00,0x64,0x00,0xff,0xff,0xb8,0x00,0x3b,0xb8,0x46,0x00,0x80,0x00,
  90. 0x64,0x00,0xc4,0x47,0xfc,0x00,0x00,0x00,0x46,0x00,0x80,0x00,0x64,0x00,0xff,
  91. 0xff,0xfc,0x00,0x36,0xd8,0x46,0x00,0x80,0x00,0x64,0x00,0xc9,0x27,0xfc,0x00,
  92. 0x00,0x00,0x46,0x00,0x80,0x00,0x64,0x00,0xff,0xff,0xfc,0x00,0x3d,0xe8,0x6e,
  93. 0x00,0x80,0x00,0x5c,0x00,0xc2,0x17,0xcc,0x00,0x00,0x00,0x46,0x00,0x80,0x00,
  94. 0x78,0x00,0xff,0xff,0xf8,0x00,0x00,0x00,0x40,0x00,0x80,0x00,0x64,0x00,0xff,
  95. 0xff,0xf8,0x00,0xbf,0xff,0xee,0x00,0x7f,0xff,0xdc,0x00,0x3f,0xff,0xcc,0x00,
  96. 0x00,0x44,0x46,0x00,0xff,0xbb,0xb8,0x00,0xff,0xbb,0xb8,0x00,0x00,0x00,0x00,
  97. 0x00,0x80,0x66,0x64,0x00,0xff,0xbb,0xb8,0x00,0xbf,0xee,0xee,0x00,0x7f,0xdd,
  98. 0xdc,0x00,0x3f,0xcc,0xcc,0x00,0x3f,0xee,0xee,0x00,0x00,0x00,0x00,0x00,0x00,
  99. 0x00,0x00,0x00, };
  100.  
  101. #define IMG \
  102.   BodychunkObject,\
  103.     MUIA_FixWidth             , LIST_WIDTH ,\
  104.     MUIA_FixHeight            , LIST_HEIGHT,\
  105.     MUIA_Bitmap_Width         , LIST_WIDTH ,\
  106.     MUIA_Bitmap_Height        , LIST_HEIGHT,\
  107.     MUIA_Bodychunk_Depth      , LIST_DEPTH ,\
  108.     MUIA_Bodychunk_Body       , (UBYTE *) list_body,\
  109.     MUIA_Bodychunk_Compression, LIST_COMPRESSION,\
  110.     MUIA_Bodychunk_Masking    , LIST_MASKING,\
  111.     MUIA_Bitmap_SourceColors  , (ULONG *) list_colors,\
  112.     MUIA_Bitmap_Transparent   , 0,\
  113.   End
  114.  
  115. /* ************ IMG2 definitions ************** */
  116.  
  117. const ULONG list2_colors[24] =
  118. {
  119.     0xabababab,0xadadadad,0xc5c5c5c5,
  120.     0x7b7b7b7b,0x7b7b7b7b,0x7b7b7b7b,
  121.     0x3b3b3b3b,0x67676767,0xa2a2a2a2,
  122.     0x00000000,0x00000000,0x00000000,
  123.     0xffffffff,0xa9a9a9a9,0x97979797,
  124.     0xffffffff,0xffffffff,0xffffffff,
  125.     0x00000000,0x00000000,0x00000000,
  126.     0xadadadad,0xadadadad,0xadadadad,
  127. };
  128.  
  129. #define LIST2_WIDTH        23
  130. #define LIST2_HEIGHT       13
  131. #define LIST2_DEPTH         3
  132. #define LIST2_COMPRESSION   0
  133. #define LIST2_MASKING       2
  134.  
  135. const UBYTE list2_body[156] = {
  136. 0x04,0x00,0x04,0x00,0x78,0x00,0x08,0x00,0x30,0x00,0x08,0x00,0x79,0x00,0x02,
  137. 0x00,0x8e,0x00,0x1c,0x00,0x3e,0x00,0x1c,0x00,0x7e,0x10,0x04,0x00,0x83,0xe0,
  138. 0x08,0x00,0xfe,0x80,0x08,0x00,0x45,0x02,0x00,0x00,0x85,0x9c,0x00,0x00,0xff,
  139. 0x70,0x00,0x00,0x7e,0x1c,0x80,0x00,0xc1,0x3b,0x78,0x00,0xfe,0xf9,0x30,0x00,
  140. 0x00,0x2f,0xb0,0x00,0xff,0x60,0x4c,0x00,0x7e,0xbf,0x48,0x00,0x7c,0x27,0x68,
  141. 0x00,0x03,0xc1,0xa4,0x00,0x01,0x7f,0xb4,0x00,0x01,0x1a,0xd8,0x00,0x03,0xe3,
  142. 0xa4,0x00,0x01,0xbf,0xac,0x00,0x00,0x6c,0xaa,0x00,0x04,0x99,0xd4,0x00,0x03,
  143. 0x97,0xfc,0x00,0x01,0x76,0x5a,0x00,0x38,0x8d,0xec,0x00,0x1e,0x8b,0x7c,0x00,
  144. 0x02,0xeb,0x72,0x00,0x0d,0x04,0xfc,0x00,0x09,0x06,0xf8,0x00,0x01,0x84,0x06,
  145. 0x00,0x0e,0x02,0xf8,0x00,0x06,0x01,0xb0,0x00,0x00,0x03,0xfc,0x00,0x00,0x00,
  146. 0x00,0x00,0x00,0x00,0x00,0x00, };
  147.  
  148. #define IMG2 \
  149.   BodychunkObject,\
  150.     MUIA_FixWidth             , LIST2_WIDTH ,\
  151.     MUIA_FixHeight            , LIST2_HEIGHT,\
  152.     MUIA_Bitmap_Width         , LIST2_WIDTH ,\
  153.     MUIA_Bitmap_Height        , LIST2_HEIGHT,\
  154.     MUIA_Bodychunk_Depth      , LIST2_DEPTH ,\
  155.     MUIA_Bodychunk_Body       , (UBYTE *) list2_body,\
  156.     MUIA_Bodychunk_Compression, LIST2_COMPRESSION,\
  157.     MUIA_Bodychunk_Masking    , LIST2_MASKING,\
  158.     MUIA_Bitmap_SourceColors  , (ULONG *) list2_colors,\
  159.     MUIA_Bitmap_Transparent   , 0,\
  160.   End
  161.  
  162. /* *********************************************** */
  163.  
  164. #define MUIA_NLIMG_Spec 0x9d51ffff
  165.  
  166. /* *********************************************** */
  167.  
  168. /* MUI STUFF */
  169.  
  170. #ifndef MAKE_ID
  171. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  172. #endif
  173.  
  174.  
  175. static APTR APP_Main,
  176.             WIN_Main,
  177.             WIN_2,
  178.             BM_img,
  179.             BM_img2,
  180.             BT_TitleOn,
  181.             BT_TitleOff,
  182.             BT_NoMulti,
  183.             BT_Multidef,
  184.             BT_Multi,
  185.             BT_AllMulti,
  186.             BT_InputOn,
  187.             BT_InputOff,
  188.             BT_Sort,
  189.             BT_DragSortOn,
  190.             BT_DragSortOff,
  191.             BT_SelLine,
  192.             BT_SelChar,
  193.             BT_OpenWin2,
  194.             BT_RemAct,
  195.             BT_RemSel,
  196.             BT_Clear,
  197.             BT_Add,
  198.             LV_Text,
  199.             LI_Text,
  200.             LV_Text2,
  201.             LI_Text2,
  202.             PR_Horiz,
  203.             ST_string;
  204.  
  205.  
  206. #define ID_LIST2_ACTIVE 1
  207.  
  208. #define NL "\n"
  209. #define NL2 " "
  210.  
  211.  
  212. /* *********************************************** */
  213.  
  214. char MainTextString2[] =
  215. {
  216.   "This new list/listview custom class has its own backgrounds" NL2
  217.   "and pens setables from mui prefs with NListviews.mcp !" NL2
  218.   "It doesn't use the same way to handle multiselection" NL2
  219.   "with mouse and keys than standard List/Listview." NL
  220.   "\033C" NL
  221.   "You can horizontally scroll with cursor keys," NL2
  222.   "or going on the right and left of the list" NL2
  223.   "while selecting with the mouse." NL2
  224.   "(When there is no immediate draggin stuff active...)" NL2
  225.   "Try just clicking on the left/right borders !" NL
  226.   "\033C" NL
  227.   "\033r\033uGive some feedback about it ! :-)" NL
  228.   "\033r\033b(masson@iut-soph.unice.fr)"
  229. };
  230.  
  231.  
  232. /* *********************************************** */
  233. char MainTextString[] =
  234. {
  235.   "\033cNList.mcc \033o[0] NListview.mcc \033o[1] NListviews.mcp" NL
  236.   "\033E\033t\033c\033o[2@1]" NL
  237.   "\033c\033nThis new list/listview custom class has its own backgrounds" NL
  238.   "\033cand pens setables from mui prefs with NListviews.mcp !" NL
  239.   "\033E\033t[M7]\033c\033o[3@2]" NL
  240.   "" NL
  241.   "\033cIt doesn't use the same way to handle multiselection" NL
  242.   "\033cwith mouse and keys than standard List/Listview." NL
  243.   "" NL
  244.   "\033cYou can horizontally scroll with cursor keys," NL
  245.   "\033cor going on the right and left of the list" NL
  246.   "\033cwhile selecting with the mouse." NL
  247.   "\033c(When there is no immediate draggin stuff active...)" NL
  248.   "\033cTry just clicking on the left/right borders !" NL
  249.   "" NL
  250.   "\033r\033uGive some feedback about it ! :-)" NL
  251.   "\033r\033b(masson@iut-soph.unice.fr)"
  252. };
  253.  
  254. /* *********************************************** */
  255.  
  256. char *MainTextArray[] =
  257. {
  258.   "\033c\033nThis new list/listview custom class has its own backgrounds",
  259.   "\033cand pens setables from mui prefs with NListviews.mcp !",
  260.   " ",
  261.   "\033cIt doesn't use the same way to handle multiselection",
  262.   "\033cwith mouse and keys than standard List/Listview.",
  263.   " ",
  264.   "\033cYou can horizontally scroll with cursor keys,",
  265.   "\033cor going on the right and left of the list",
  266.   "\033cwhile selecting with the mouse.",
  267.   "\033c(When there is no draggin stuff active...)",
  268.   "\033cTry just clicking on the left/right borders !",
  269.   "",
  270.   "\033r\033uGive some feedback about it ! :-)",
  271.   "\033r\033b(masson@iut-soph.unice.fr)",
  272.   "",
  273.   "",
  274.   "",
  275.   "The numbers in the left column are list entry numbers !",
  276.   "So don't be surprised if sorting entries",
  277.   "don't change that numbers...",
  278.   "",
  279.   "You can push column titles as real buttons...",
  280.   "",
  281.   "You can drag column separator bar in",
  282.   "the title to adjust column width...",
  283.   "(or in upper half of first entry if title is off)",
  284.   "",
  285.   "If, while dragging the bar, you press the",
  286.   "menu button, the width of the column will",
  287.   "come back to its default...",
  288.   "",
  289.   "",
  290.   "\033cF2 to copy selected lines to printer",
  291.   "\033cF3 to copy all lines to file RAM:tmp.txt",
  292.   "",
  293.   "\033cF4 to copy selected lines to clipboard 0.",
  294.   "\033cF5 to copy active line to clipboard 0.",
  295.   "\033cF6 to copy all lines to clipboard 0.",
  296.   "",
  297.   "\033cThe classic RightAmiga+C to copy selected",
  298.   "\033clines to clipboard 0 is made builtin.",
  299.   " ",
  300.   " ",
  301.   "\033cYou can sort the entries by dragging.",
  302.   "\033cYou start a drag using one of the qualifier",
  303.   "\033ckeys which are set in prefs,",
  304.   "\033cor going on the left and right of entries.",
  305.   "",
  306.   "",
  307.   "Example of horizontal line in top of entry",
  308.   "\033TExample of horizontal line in top of entry",
  309.   "Example of horizontal line in top of entry",
  310.   "",
  311.   "Examples of horizontal line and thick line centered on entry",
  312.   "\033C",
  313.   "\033C\033t",
  314.   "\033C\033t[I7]",
  315.   "\033C\033t[M7]",
  316.   "\033C\033t[-5]",
  317.   "\033C\033t[N]",
  318.   "\033C\033t[NI3]",
  319.   "\033C\033t[NM7]",
  320.   "\033C\033t[N-5]",
  321.   "Examples of horizontal line and thick line centered on entry",
  322.   "",
  323.   "Example of horizontal line in bottom of entry",
  324.   "\033BExample of horizontal line in bottom of entry",
  325.   "Example of horizontal line in bottom of entry",
  326.   "",
  327.   "Examples of horizontal line centered on entry visible on left and rigth only",
  328.   "\033c\033EExample of left-right horizontal line",
  329.   "\033ESame, but left aligned",
  330.   "\033r\033ESame, but right aligned",
  331.   "\033t\033c\033ELeft-right horizontal thick line",
  332.   "\033t[N]\033c\033ELeft-right horizontal thick line",
  333.   "Examples of horizontal line centered on entry visible on left and rigth only",
  334.   "",
  335.   "",
  336.   "\033E\033cExamples of bitmap images :",
  337.   "\033c\033o[0]  \033o[1]",
  338.   "which can be used without subclassing the NList class.",
  339.   "",
  340.   "\033E\033cExamples of custom object images : ",
  341.   "\033o[2;9d51ffff;1]  (default width/special 1)",
  342.   "\033o[2;9d51ffff;0,24] (24 pixel width/special 0)",
  343.   "\033o[2;9d51ffff;1,48] (48 pixel width/special 1)",
  344.   "\033o[2;9d51ffff;0,96] (96 pixel width/special 0)",
  345.   "",
  346.   "\033E\033cExamples of custom object images : ",
  347.   "\033o[2;9d51ffff;8,30]  (default width/special 8)",
  348.   "\033o[2;9d51ffff;6,40]  (default width/special 6)",
  349.   "\033o[2;9d51ffff;7,40] (40 pixel width/special 7)",
  350.   "\033o[2;9d51ffff;4,50] (50 pixel width/special 4)",
  351.   "\033o[2;9d51ffff;5,50] (50 pixel width/special 5)",
  352.   "\033o[2;9d51ffff;2,30] (30 pixel width/special 2)",
  353.   "\033o[2;9d51ffff;3,30] (30 pixel width/special 3)",
  354.   "",
  355.   "\033E\033cExamples of direct ImageSpec :",
  356.   "kmel/kmel_arrowdown.image :    \033I[3:kmel/kmel_arrowdown.image]",
  357.   "WD/11pt/ArrowLeft.mf0 :    \033I[3:WD/11pt/ArrowLeft.mf0]",
  358.   "",
  359.   "\033C",
  360.   "",
  361.   "ww\tTabulation test",
  362.   "w\tTabulation test",
  363.   "\033cww\tTabulation test",
  364.   "\033cw\tTabulation test",
  365.   "\033rww\tTabulation test",
  366.   "\033rw\tTabulation test",
  367.   "",
  368.   "",
  369.   "long line for FULLAUTO horizontal scroller test, long line for FullAuto horizontal scroller test, long line for FULLAUTO horizontal scroller test.",
  370.   "",
  371.   "0 just a little \033bline to test\033n stuffs",
  372.   "1 just a little \033bline to test\033n stuffs",
  373.   "2 just a little \033bline to test\033n stuffs",
  374.   "3 just a little \033bline to test\033n stuffs",
  375.   "\033c4 just a little \033uline to test\033n (center)",
  376.   "\033c5 just a little \033uline to test\033n (center)",
  377.   "\033c6 just a little \033uline to test\033n (center)",
  378.   "\033r7 just a little \033uline to test\033n (right)",
  379.   "\033r8 just a little \033uline to test\033n (right)",
  380.   "\033r9 just a little \033uline to test\033n (right)",
  381.   "10 just a little line to test stuffs and bugs",
  382.   "11 just a little line to test stuffs and bugs",
  383.   "12 just a little line to test stuffs and bugs",
  384.   "13 just a little line to test stuffs and bugs",
  385.   "14 just a little line to test stuffs and bugs",
  386.   "15 just a little \033iline to test stuffs\033n and bugs",
  387.   "16 just a little line to test stuffs and bugs",
  388.   "17 just a little line to test stuffs and bugs",
  389.   "18 just a little line to test stuffs and bugs",
  390.   "19 just a little line to test stuffs and bugs",
  391.   "\033c20 just a little line to test stuffs and bugs (center)",
  392.   "\033c21 just a little line to test stuffs and bugs (center)",
  393.   "\033c22 just a little line to test stuffs and bugs (center)",
  394.   "\033c23 just a little line to test stuffs and bugs (center)",
  395.   "24 just a little line to test stuffs and bugs, just a little line",
  396.   "25 just a little line to test stuffs and bugs, just a little line",
  397.   "\033r26 just a little line to test stuffs and bugs (right)",
  398.   "\033r27 just a little line to test stuffs and bugs (right)",
  399.   "\033r28 just a little line to test stuffs and bugs (right)",
  400.   "\033r29 just a little line to test stuffs and bugs (right)",
  401.   "30 just a little line to test stuffs and bugs, just a little line to test",
  402.   "31 just a little line to test stuffs and bugs, just a little line to test",
  403.   "32 \0332just a little line to test stuffs and bugs, just a little line to test",
  404.   "33 \0333just a little line to test stuffs and bugs, just a little line to test",
  405.   "34 \0334just a little line to test stuffs and bugs, just a little line to test",
  406.   "35 \0335just a little line to test stuffs and bugs, just a little line to test",
  407.   "36 \0336just a little line to test stuffs and bugs, just a little line to test",
  408.   "37 \0337just a little line to test stuffs and bugs, just a little line to test",
  409.   "38 \0338just a little line to test stuffs and bugs, just a little line to test",
  410.   "39 \0339just a little line to test stuffs and bugs, just a little line to test",
  411.   "40 \033P[]just a little line to test stuffs and bugs, just a little line to test stuffs ",
  412.   "41 \033P[1]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
  413.   "42 \033P[2]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
  414.   "43 \033P[-1]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
  415.   "44 \033P[-3]just a little line to test\033P[] stuffs and bugs, just a little line to test stuffs ",
  416.   "45 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  417.   "46 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  418.   "47 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  419.   "48 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  420.   "49 just a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  421.   "50 \033ijust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  422.   "51 \033ujust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  423.   "52 \033bjust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  424.   "53 \033i\033ujust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  425.   "54 \033i\033bjust a little line to test stuffs and bugs, just a little line to test stuffs and bugs",
  426.   "55 \033b\033ujust a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
  427.   "56 \033i\033b\033ujust a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
  428.   "57 just a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
  429.   "58 just a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
  430.   "59 just a little line to test stuffs and bugs, just a little line to test, just a little line to test, just a little line to test",
  431.   " ",
  432.   " ",
  433.   "\033c\033uI find it \033bnice\033n  :-)",
  434.   NULL
  435. };
  436.  
  437.  
  438. /* *********************************************** */
  439.  
  440. struct MUI_CustomClass *NLI_Class = NULL;
  441.  
  442. #define NImageObject NewObject(NLI_Class->mcc_Class,NULL,MUIA_FillArea,FALSE,NoFrame,End
  443.  
  444. struct NLIData
  445. {
  446.   LONG special;
  447.   LONG EntryCurrent;
  448.   LONG EntryHeight;
  449. };
  450.  
  451. ULONG mNLI_Draw(struct IClass *cl,Object *obj,struct MUIP_Draw *msg)
  452. {
  453.   register struct NLIData *data = INST_DATA(cl,obj);
  454.   DoSuperMethodA(cl,obj,(Msg) msg);
  455.   if ((msg->flags & MADF_DRAWOBJECT) || (msg->flags & MADF_DRAWUPDATE))
  456.   { WORD x1,x2,x3,x4,x5,y1,y2,y3,y4,y5;
  457.     y1 = _top(obj);
  458.     y2 = _bottom(obj);
  459.     x1 = _left(obj);
  460.     x2 = _right(obj);
  461.     if ((data->special == 0) || (data->special == 1))
  462.     {
  463.       y3 = (y1+y2)/2;
  464.       x3 = (x1+x2)/2;
  465.       SetAPen(_rp(obj),_pens(obj)[MPEN_MARK]);
  466.       SetBPen(_rp(obj),_pens(obj)[MPEN_SHADOW]);
  467.       SetDrMd(_rp(obj),JAM2);
  468.       SetDrPt(_rp(obj),(UWORD) ~0);
  469.       if      (data->special == 0)
  470.       { Move(_rp(obj), x3-2, y1+1);
  471.         Draw(_rp(obj), x3-2, y2-1);
  472.         Move(_rp(obj), x3, y1+1);
  473.         Draw(_rp(obj), x3, y2-1);
  474.         Move(_rp(obj), x3+2, y1+1);
  475.         Draw(_rp(obj), x3+2, y2-1);
  476.       }
  477.       else if (data->special == 1)
  478.       { Move(_rp(obj), x1, y3-2);
  479.         Draw(_rp(obj), x2, y3-2);
  480.         Move(_rp(obj), x1, y3);
  481.         Draw(_rp(obj), x2, y3);
  482.         Move(_rp(obj), x1, y3+2);
  483.         Draw(_rp(obj), x2, y3+2);
  484.       }
  485.       SetAPen(_rp(obj),_pens(obj)[MPEN_SHADOW]);
  486.       Move(_rp(obj), x1, y2-1);
  487.       Draw(_rp(obj), x1, y1+1);
  488.       Draw(_rp(obj), x2, y1+1);
  489.       SetAPen(_rp(obj),_pens(obj)[MPEN_SHINE]);
  490.       Draw(_rp(obj), x2, y2-1);
  491.       Draw(_rp(obj), x1, y2-1);
  492.       SetDrMd(_rp(obj),JAM1);
  493.     }
  494.     else if (((x2 - x1) >= 10) && ((y2 - y1) >= 8))   /* and special==2 to 9 */
  495.     {
  496.       y3 = (y1+y2)/2;
  497.       x3 = x1 + 1;
  498.       x2--;
  499.       SetAPen(_rp(obj),_pens(obj)[MPEN_SHADOW]);
  500.       SetDrMd(_rp(obj),JAM1);
  501.  
  502.       y4 = y1;
  503.       x4 = x3 + 2;
  504.       y5 = y2;
  505.       x5 = x2-6;
  506.       if ((data->EntryHeight & 1) && (data->EntryCurrent & 1))
  507.         y4++;
  508.       if ((y4 & 1) != (y3 & 1))
  509.         x4--;
  510.       if (data->special > 5)
  511.         x5 = x2;
  512.       if (data->special & 1)
  513.         y5 = y3;
  514.       while (y4 <= y5)
  515.       { WritePixel(_rp(obj), x3, y4);
  516.         y4 += 2;
  517.       }
  518.       if (data->special <= 7)
  519.       {
  520.         while (x4 <= x5)
  521.         { WritePixel(_rp(obj), x4, y3);
  522.           x4 += 2;
  523.         }
  524.       }
  525.       if (data->special <= 5)
  526.       {
  527.         Move(_rp(obj), x2-6, y3);
  528.         Draw(_rp(obj), x2-6, y3-3);
  529.         Draw(_rp(obj),   x2, y3-3);
  530.         Draw(_rp(obj),   x2, y3+3);
  531.         Draw(_rp(obj), x2-6, y3+3);
  532.         Draw(_rp(obj), x2-6, y3);
  533.         Move(_rp(obj), x2-4, y3);
  534.         Draw(_rp(obj), x2-2, y3);
  535.         if ((data->special == 2) || (data->special == 3))
  536.         { Move(_rp(obj), x2-3, y3-1);
  537.           Draw(_rp(obj), x2-3, y3+1);
  538.         }
  539.       }
  540.     }
  541.   }
  542.   msg->flags = 0;
  543.   return(0);
  544. }
  545.  
  546. ULONG mNLI_New(struct IClass *cl,Object *obj,struct opSet *msg)
  547. {
  548.   register struct NLIData *data;
  549.   if (!(obj = (Object *)DoSuperMethodA(cl,obj,(Msg) msg)))
  550.     return(0);
  551.   data = INST_DATA(cl,obj);
  552.   data->special = 0;
  553.   return((ULONG) obj);
  554. }
  555.  
  556. ULONG mNLI_AskMinMax(struct IClass *cl,Object *obj,struct MUIP_AskMinMax *msg)
  557. {
  558.   DoSuperMethodA(cl,obj,(Msg) msg);
  559.   msg->MinMaxInfo->MinWidth  += 8;
  560.   msg->MinMaxInfo->DefWidth  += 18; /* the only width def value really used by NList object */
  561.   msg->MinMaxInfo->MaxWidth  += MUI_MAXMAX;
  562.   msg->MinMaxInfo->MinHeight += 7;  /* the only height def value really used by NList object */
  563.   msg->MinMaxInfo->DefHeight += 12;
  564.   msg->MinMaxInfo->MaxHeight += MUI_MAXMAX;
  565.   return(0);
  566. }
  567.  
  568. ULONG mNLI_Set(struct IClass *cl,Object *obj,Msg msg)
  569. {
  570.   register struct NLIData *data = INST_DATA(cl,obj);
  571.   struct TagItem *tags,*tag;
  572.   for (tags=((struct opSet *)msg)->ops_AttrList;tag=(struct TagItem *) NextTagItem(&tags);)
  573.   { switch (tag->ti_Tag)
  574.     {
  575.       case MUIA_NLIMG_EntryCurrent:
  576.         data->EntryCurrent = tag->ti_Data;
  577.         break;
  578.       case MUIA_NLIMG_EntryHeight:
  579.         data->EntryHeight = tag->ti_Data;
  580.         break;
  581.       case MUIA_NLIMG_Spec:
  582.         data->special = tag->ti_Data;
  583.         break;
  584.     }
  585.   }
  586.   return (0);
  587. }
  588.  
  589.  
  590. #ifdef __SASC
  591. SAVEDS ASM ULONG NLI_Dispatcher(REG(a0) struct IClass *cl, REG(a2) Object *obj, REG(a1) Msg msg)
  592. {
  593. #endif
  594. #ifdef __GNUC__
  595. ULONG NLI_Dispatcher(void)
  596. { register struct IClass *a0 __asm("a0"); struct IClass *cl = a0;
  597.   register Object *a2 __asm("a2");        Object *obj = a2;
  598.   register Msg a1 __asm("a1");            Msg msg = a1;
  599. #endif
  600.   switch (msg->MethodID)
  601.   {
  602.     case OM_NEW         : return (      mNLI_New(cl,obj,(APTR)msg));
  603.     case OM_SET         : return (      mNLI_Set(cl,obj,(APTR)msg));
  604.     case MUIM_AskMinMax : return (mNLI_AskMinMax(cl,obj,(APTR)msg));
  605.     case MUIM_Draw      : return (     mNLI_Draw(cl,obj,(APTR)msg));
  606.   }
  607.   return(DoSuperMethodA(cl,obj,msg));
  608. }
  609.  
  610.  
  611.  
  612. struct MUI_CustomClass *NLI_Create(void)
  613. {
  614.   NLI_Class = MUI_CreateCustomClass(NULL,MUIC_Area,NULL,sizeof(struct NLIData),NLI_Dispatcher);
  615.   return (NLI_Class);
  616. }
  617.  
  618. void NLI_Delete(void)
  619. {
  620.   if (NLI_Class)
  621.     MUI_DeleteCustomClass(NLI_Class);
  622.   NLI_Class = NULL;
  623. }
  624.  
  625. /* *********************************************** */
  626.  
  627.  
  628. static VOID fail(APTR APP_Main,char *str)
  629. {
  630.   if (APP_Main)
  631.     MUI_DisposeObject(APP_Main);
  632.   NLI_Delete();
  633.   if (MUIMasterBase)
  634.     CloseLibrary(MUIMasterBase);
  635.   if (str)
  636.   { puts(str);
  637.     exit(20);
  638.   }
  639.   exit(0);
  640. }
  641.  
  642.  
  643. static VOID init(VOID)
  644. {
  645.   APP_Main = NULL;
  646.   if (!(MUIMasterBase = (struct Library *) OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN-1)))
  647.     fail(NULL,"Failed to open "MUIMASTER_NAME".");
  648.   if (!NLI_Create())
  649.     fail(NULL,"Failed to create NLI class.");
  650. }
  651.  
  652.  
  653. /* *********************************************** */
  654.  
  655. static char buf[20];
  656.  
  657. #ifdef __SASC
  658. SAVEDS ASM void DisplayLI_TextFunc(REG(a0) struct Hook *hook, REG(a2) Object *obj, REG(a1) struct NList_DisplayMessage *ndm)
  659. {
  660. #endif
  661. #ifdef __GNUC__
  662. static void DisplayLI_TextFunc(void)
  663. { register Object *a2 __asm("a2");                      Object *obj = a2;
  664.   register struct NList_DisplayMessage *a1 __asm("a1"); struct NList_DisplayMessage *ndm = a1;
  665.   register struct Hook *a0 __asm("a0");                 struct Hook *hook = a0;
  666. #endif
  667.  
  668.   if (ndm->entry)
  669.   { ndm->preparses[0]  = "\033c";
  670.     if      (ndm->entry_pos % 20 == 3)
  671.       ndm->strings[0] = "\033o[0]";
  672.     else if (ndm->entry_pos % 20 == 13)
  673.       ndm->strings[0] = "\033o[1]";
  674.     else
  675.     { sprintf(buf,"%ld",ndm->entry_pos);
  676.       ndm->strings[0]  = buf;
  677.     }
  678.     ndm->strings[1]  = (char *) ndm->entry;
  679.   }
  680.   else
  681.   {
  682.     ndm->preparses[0]  = "\033c";
  683.     ndm->preparses[1]  = "\033c";
  684.     ndm->strings[0]  = "Num";
  685.     ndm->strings[1]  = "This is the list title !\033n\033b   :-)";
  686.   }
  687. }
  688.  
  689. /* *********************************************** */
  690.  
  691. #define SimpleButtonCycle(name) \
  692.   TextObject, \
  693.     ButtonFrame, \
  694.     MUIA_CycleChain, 1, \
  695.     MUIA_Font, MUIV_Font_Button, \
  696.     MUIA_Text_Contents, name, \
  697.     MUIA_Text_PreParse, "\33c", \
  698.     MUIA_InputMode    , MUIV_InputMode_RelVerify, \
  699.     MUIA_Background   , MUII_ButtonBack, \
  700.   End
  701.  
  702. #define SimpleButtonTiny(name) \
  703.   TextObject, \
  704.     ButtonFrame, \
  705.     MUIA_Font, MUIV_Font_Tiny, \
  706.     MUIA_Text_Contents, name, \
  707.     MUIA_Text_PreParse, "\33c", \
  708.     MUIA_InputMode    , MUIV_InputMode_RelVerify, \
  709.     MUIA_Background   , MUII_ButtonBack, \
  710.   End
  711.  
  712. /* *********************************************** */
  713.  
  714. #define NFloattext(ftxt) \
  715.     NListviewObject, \
  716.       MUIA_Weight, 50, \
  717.       MUIA_CycleChain, 1, \
  718.       MUIA_NListview_Horiz_ScrollBar, MUIV_NListview_HSB_None, \
  719.       MUIA_NListview_Vert_ScrollBar, MUIV_NListview_VSB_Always, \
  720.       MUIA_NListview_NList,NFloattextObject, \
  721.         MUIA_NList_DefaultObjectOnClick, TRUE, \
  722.         MUIA_NFloattext_Text, ftxt, \
  723.         MUIA_NFloattext_TabSize, 4, \
  724.         MUIA_NFloattext_Justify, TRUE, \
  725.       End, \
  726.     End
  727.  
  728. /* *********************************************** */
  729.  
  730. /* MAIN PROGRAM */
  731. int main(int argc,char *argv[])
  732. {
  733.   LONG win_opened;
  734.   LONG result;
  735.   static const struct Hook DisplayLI_TextHook = { { NULL,NULL },(VOID *)DisplayLI_TextFunc, NULL,NULL };
  736.  
  737.   init();
  738.  
  739.   APP_Main = ApplicationObject,
  740.     MUIA_Application_Title      , "NList-Demo",
  741.     MUIA_Application_Version    , "$VER: NList-Demo 0.7 (" __DATE__ ")",
  742.     MUIA_Application_Copyright  , "Written by Gilles Masson, 1996-1998",
  743.     MUIA_Application_Author     , "Gilles Masson",
  744.     MUIA_Application_Description, "NList-Demo",
  745.     MUIA_Application_Base       , "NList-Demo",
  746.  
  747.     SubWindow, WIN_Main = WindowObject,
  748.       MUIA_Window_Title, "NList-Demo 1996-1998",
  749.       MUIA_Window_ID   , MAKE_ID('T','W','I','N'),
  750.       WindowContents, VGroup,
  751.         Child, HGroup,
  752.           Child, BT_InputOn = SimpleButtonCycle("InputOn"),
  753.           Child, BT_InputOff = SimpleButtonCycle("InputOff"),
  754.           Child, BT_SelLine = SimpleButtonCycle("SelLine"),
  755.           Child, BT_SelChar = SimpleButtonCycle("SelChar"),
  756.           Child, BT_Clear = SimpleButtonCycle("Clear"),
  757.           Child, BT_Add = SimpleButtonCycle("Add"),
  758.         End,
  759.         Child, HGroup,
  760.           Child, BT_NoMulti = SimpleButtonCycle("NoMulti"),
  761.           Child, BT_Multidef = SimpleButtonCycle("Def"),
  762.           Child, BT_Multi = SimpleButtonCycle("Multi"),
  763.           Child, BT_AllMulti = SimpleButtonCycle("AllMulti"),
  764.           Child, BM_img = IMG,
  765.           Child, BT_RemAct = SimpleButtonCycle("RemAct"),
  766.           Child, BT_RemSel = SimpleButtonCycle("RemSel"),
  767.         End,
  768.         Child, HGroup,
  769.           Child, BT_DragSortOn = SimpleButtonCycle("DragSortOn"),
  770.           Child, BT_DragSortOff = SimpleButtonCycle("DragSortOff"),
  771.           Child, BM_img2 = IMG2,
  772.           Child, BT_TitleOn = SimpleButtonCycle("TitleOn"),
  773.           Child, BT_TitleOff = SimpleButtonCycle("TitleOff"),
  774.           Child, BT_Sort = SimpleButtonCycle("Sort"),
  775.           Child, BT_OpenWin2 = SimpleButtonCycle("Win2"),
  776.         End,
  777.         Child, LV_Text = NListviewObject,
  778.           MUIA_CycleChain, 1,
  779.  
  780.           MUIA_NListview_NList, LI_Text = NListObject,
  781.             MUIA_ObjectID, MAKE_ID('N','L','0','1'),
  782.             MUIA_NList_DefaultObjectOnClick, TRUE,
  783.             MUIA_NList_MultiSelect, MUIV_NList_MultiSelect_None,
  784.             MUIA_NList_DisplayHook2, &DisplayLI_TextHook,
  785.             MUIA_NList_Format, "BAR W=-1,BAR",
  786.             MUIA_NList_SourceArray, MainTextArray,
  787.             MUIA_NList_AutoVisible, TRUE,
  788.             MUIA_NList_TitleSeparator, TRUE,
  789.             MUIA_NList_Title, TRUE,
  790.             MUIA_NList_EntryValueDependent, TRUE,
  791.             MUIA_NList_MinColSortable, 0,
  792.             MUIA_NList_TitleMark, (MUIV_NList_TitleMark_Box|0) ,
  793.             MUIA_NList_Imports, MUIV_NList_Imports_All,
  794.             MUIA_NList_Exports, MUIV_NList_Exports_All,
  795.           End,
  796.           MUIA_ShortHelp, "The nice multicolumn\ndraggable list\nwith char selection\npossibility :)",
  797.         End,
  798.       End,
  799.     End,
  800.     SubWindow, WIN_2 = WindowObject,
  801.       MUIA_Window_Title, "NList-Demo 1996-1998 Win 2",
  802.       MUIA_Window_ID   , MAKE_ID('W','I','N','2'),
  803.       MUIA_Window_UseBottomBorderScroller, TRUE,
  804.       WindowContents, VGroup,
  805.         Child, NFloattext(MainTextString2),
  806.         Child, BalanceObject, End,
  807.         Child, VGroup,
  808.           MUIA_Group_VertSpacing, 1,
  809.           Child, LV_Text2 = NListviewObject,
  810.             MUIA_CycleChain, 1,
  811.             MUIA_NListview_Horiz_ScrollBar, MUIV_NListview_HSB_None,
  812.             MUIA_NListview_NList, LI_Text2 = NListObject,
  813.               MUIA_NList_DefaultObjectOnClick, TRUE,
  814.               MUIA_NList_ConstructHook, MUIV_NList_ConstructHook_String,
  815.               MUIA_NList_DestructHook, MUIV_NList_DestructHook_String,
  816.               MUIA_NList_SourceString, MainTextString,
  817.             End,
  818.             MUIA_ShortHelp, "The 2nd list",
  819.           End,
  820.           Child, ST_string = StringObject,
  821.             MUIA_CycleChain, 1,
  822.             StringFrame,
  823.           End,
  824.           Child, PR_Horiz = ScrollbarObject,
  825.             MUIA_Group_Horiz, TRUE,
  826.             MUIA_Prop_UseWinBorder,MUIV_Prop_UseWinBorder_Bottom,
  827.           End,
  828.         End,
  829.       End,
  830.     End,
  831.   End;
  832.  
  833.   if(!APP_Main) fail(APP_Main,"Failed to create Application.");
  834.  
  835.   DoMethod(BT_TitleOn, MUIM_Notify, MUIA_Pressed,FALSE,
  836.     LI_Text, 3, MUIM_Set,MUIA_NList_Title,"\033cThis is that list title !   :-)");
  837.   DoMethod(BT_TitleOff, MUIM_Notify, MUIA_Pressed,FALSE,
  838.     LI_Text, 3, MUIM_Set,MUIA_NList_Title,NULL);
  839.  
  840.   DoMethod(BT_NoMulti, MUIM_Notify, MUIA_Pressed,FALSE,
  841.     LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_None);
  842.   DoMethod(BT_Multidef, MUIM_Notify, MUIA_Pressed,FALSE,
  843.     LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_Default);
  844.   DoMethod(BT_Multi, MUIM_Notify, MUIA_Pressed,FALSE,
  845.     LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_Shifted);
  846.   DoMethod(BT_AllMulti, MUIM_Notify, MUIA_Pressed,FALSE,
  847.     LI_Text, 3, MUIM_Set,MUIA_NList_MultiSelect,MUIV_NList_MultiSelect_Always);
  848.  
  849.   DoMethod(BT_InputOn, MUIM_Notify, MUIA_Pressed,FALSE,
  850.     LI_Text, 3, MUIM_Set,MUIA_NList_Input,TRUE);
  851.   DoMethod(BT_InputOff, MUIM_Notify, MUIA_Pressed,FALSE,
  852.     LI_Text, 3, MUIM_Set,MUIA_NList_Input,FALSE);
  853.  
  854.   DoMethod(BT_DragSortOn, MUIM_Notify, MUIA_Pressed,FALSE,
  855.     LI_Text, 3, MUIM_Set,MUIA_NList_DragSortable,TRUE);
  856.   DoMethod(BT_DragSortOff, MUIM_Notify, MUIA_Pressed,FALSE,
  857.     LI_Text, 3, MUIM_Set,MUIA_NList_DragSortable,FALSE);
  858.  
  859.   DoMethod(BT_RemAct, MUIM_Notify, MUIA_Pressed,FALSE,
  860.     LI_Text, 2, MUIM_NList_Remove,MUIV_NList_Remove_Active);
  861.   DoMethod(BT_RemSel, MUIM_Notify, MUIA_Pressed,FALSE,
  862.     LI_Text, 2, MUIM_NList_Remove,MUIV_NList_Remove_Selected);
  863.   DoMethod(BT_Clear, MUIM_Notify, MUIA_Pressed,FALSE,
  864.     LI_Text, 1, MUIM_NList_Clear);
  865.   DoMethod(BT_Add, MUIM_Notify, MUIA_Pressed,FALSE,
  866.     LI_Text, 4, MUIM_NList_Insert,MainTextArray,15,MUIV_NList_Insert_Bottom);
  867.  
  868.   DoMethod(BT_Sort, MUIM_Notify, MUIA_Pressed,FALSE,
  869.     LI_Text, 1, MUIM_NList_Sort);
  870.  
  871.   DoMethod(BT_SelLine, MUIM_Notify, MUIA_Pressed,FALSE,
  872.     LI_Text, 3, MUIM_Set,MUIA_NList_TypeSelect,MUIV_NList_TypeSelect_Line);
  873.   DoMethod(BT_SelChar, MUIM_Notify, MUIA_Pressed,FALSE,
  874.     LI_Text, 3, MUIM_Set,MUIA_NList_TypeSelect,MUIV_NList_TypeSelect_Char);
  875.  
  876.   DoMethod(BT_OpenWin2, MUIM_Notify, MUIA_Pressed,FALSE,
  877.     WIN_2, 3, MUIM_Set,MUIA_Window_Open,TRUE);
  878.  
  879.   DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f2",
  880.     LI_Text, 4,MUIM_NList_CopyTo,MUIV_NList_CopyTo_Selected,"PRT:",&result,NULL);
  881.   DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f3",
  882.     LI_Text, 4,MUIM_NList_CopyTo,MUIV_NList_CopyTo_All,"RAM:tmp.txt",&result,NULL);
  883.   DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f4",
  884.     LI_Text, 4,MUIM_NList_CopyToClip,MUIV_NList_CopyToClip_Selected,0L,NULL,NULL);
  885.   DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f5",
  886.     LI_Text, 4,MUIM_NList_CopyToClip,MUIV_NList_CopyToClip_Active,0L,NULL,NULL);
  887.   DoMethod(WIN_Main,MUIM_Notify, MUIA_Window_InputEvent, "f6",
  888.     LI_Text, 4,MUIM_NList_CopyToClip,MUIV_NList_CopyToClip_All,0L,NULL,NULL);
  889.  
  890.   DoMethod(LI_Text, MUIM_Notify, MUIA_NList_TitleClick,MUIV_EveryTime,
  891.     LI_Text, 3, MUIM_Set, MUIA_NList_Active,MUIV_TriggerValue);
  892.  
  893.   DoMethod(LI_Text, MUIM_Notify, MUIA_NList_TitleClick,MUIV_EveryTime,
  894.     LI_Text, 3, MUIM_Set, MUIA_NList_TitleMark,MUIV_TriggerValue);
  895.  
  896.   DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_Horiz_Entries,MUIV_EveryTime,
  897.     PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_Entries,MUIV_TriggerValue);
  898.   DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_Horiz_Visible,MUIV_EveryTime,
  899.     PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_Visible,MUIV_TriggerValue);
  900.   DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_Horiz_First,MUIV_EveryTime,
  901.     PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_First,MUIV_TriggerValue);
  902.   DoMethod(PR_Horiz, MUIM_Notify, MUIA_Prop_First,MUIV_EveryTime,
  903.     LI_Text2, 3, MUIM_NoNotifySet,MUIA_NList_Horiz_First,MUIV_TriggerValue);
  904.   DoMethod(LI_Text2, MUIM_Notify, MUIA_NList_HorizDeltaFactor,MUIV_EveryTime,
  905.     PR_Horiz, 3, MUIM_NoNotifySet,MUIA_Prop_DeltaFactor,MUIV_TriggerValue);
  906.  
  907.   set(ST_string, MUIA_String_AttachedList, LI_Text2);
  908.   DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_SelectChange,TRUE,APP_Main,2,MUIM_Application_ReturnID,ID_LIST2_ACTIVE);
  909.   DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_Active,MUIV_EveryTime,APP_Main,2,MUIM_Application_ReturnID,ID_LIST2_ACTIVE);
  910.   set(LI_Text2, MUIA_NList_Active, 2);
  911.  
  912.  
  913.   DoMethod(WIN_Main,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
  914.     APP_Main, 5, MUIM_Application_PushMethod,
  915.     APP_Main,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  916.  
  917.   DoMethod(WIN_2,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
  918.     APP_Main, 6, MUIM_Application_PushMethod,
  919.     WIN_2, 3, MUIM_Set,MUIA_Window_Open,FALSE);
  920.  
  921.   DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_ButtonClick, 1,
  922.     APP_Main, 6, MUIM_Application_PushMethod,
  923.     WIN_2, 3, MUIM_Set,MUIA_Window_Open,FALSE);
  924.  
  925.   DoMethod(LI_Text2,MUIM_Notify,MUIA_NList_ButtonClick, 2,
  926.     LI_Text, 1, MUIM_NList_Clear);
  927.  
  928.   set(WIN_Main, MUIA_Window_DefaultObject, LV_Text);
  929.   set(WIN_Main, MUIA_Window_ActiveObject, LV_Text);
  930.   set(WIN_2, MUIA_Window_ActiveObject, ST_string);
  931.   set(WIN_2, MUIA_Window_DefaultObject, LV_Text2);
  932.  
  933.   DoMethod(LI_Text,MUIM_NList_UseImage,BM_img,0,0);
  934.   DoMethod(LI_Text,MUIM_NList_UseImage,BM_img2,1,0);
  935.  
  936.   DoMethod(LI_Text,MUIM_NList_UseImage,NImageObject,2,~0L);
  937.  
  938.   DoMethod(LI_Text2,MUIM_NList_UseImage,BM_img,0,0);
  939.   DoMethod(LI_Text2,MUIM_NList_UseImage,BM_img2,1,0);
  940.  
  941.   DoMethod(LI_Text2,MUIM_NList_UseImage,SimpleButtonTiny("Click me to close"),2,~0L);
  942.   DoMethod(LI_Text2,MUIM_NList_UseImage,SimpleButtonTiny("Clear main list"),3,~0L);
  943.  
  944.  
  945.   DoMethod(APP_Main,MUIM_Application_Load,MUIV_Application_Load_ENVARC);
  946.  
  947.   set(WIN_2,MUIA_Window_Open,TRUE);
  948.   set(WIN_Main,MUIA_Window_Open,TRUE);
  949.  
  950.   get(WIN_Main,MUIA_Window_Open,&win_opened);
  951.   if (win_opened)
  952.   { ULONG id,sigs = 0;
  953.     char *line;
  954.  
  955.     while ((id = DoMethod(APP_Main,MUIM_Application_NewInput,&sigs)) != MUIV_Application_ReturnID_Quit)
  956.     {
  957.       if (id == ID_LIST2_ACTIVE)
  958.       { DoMethod(LI_Text2, MUIM_NList_GetEntry, MUIV_NList_GetEntry_Active, &line);
  959.         set(ST_string, MUIA_String_Contents, line);
  960.         set(WIN_2, MUIA_Window_ActiveObject, ST_string);
  961.       }
  962.       if (sigs)
  963.       { sigs = Wait(sigs | SIGBREAKF_CTRL_C);
  964.         if (sigs & SIGBREAKF_CTRL_C) break;
  965.       }
  966.     }
  967.   }
  968.   else
  969.     printf("failed to open main window !\n");
  970.  
  971.   DoMethod(APP_Main,MUIM_Application_Save,MUIV_Application_Save_ENVARC);
  972.  
  973.   set(WIN_2,MUIA_Window_Open,FALSE);
  974.   set(WIN_Main,MUIA_Window_Open,FALSE);
  975.  
  976.   DoMethod(LI_Text,MUIM_NList_UseImage,NULL,-1,0);
  977.   DoMethod(LI_Text2,MUIM_NList_UseImage,NULL,-1,0);
  978.  
  979.   fail(APP_Main,NULL);
  980. }
  981.  
  982.